//
//  FHStatusBottomView.swift
//  FHweibo
//
//  Created by 张嵩雷 on 16/4/14.
//  Copyright © 2016年 feng. All rights reserved.
//

import UIKit

class FHStatusBottomView: UIView {

    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        prepareUI()
    }
    
    private func prepareUI() {
        //1.添加子控件
        addSubview(retweetButton)
        addSubview(commetButton)
        addSubview(likeButton)
        addSubview(separatorViewFirst)
        addSubview(separatorViewSecond)
        
        //2.添加约束
        //转发按钮
        retweetButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
        }
        
        //评论按钮
        commetButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(retweetButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(retweetButton)
        }
        
        //赞按钮
        likeButton.snp_makeConstraints { (make) -> Void in
            
            make.leading.equalTo(commetButton.snp_trailing)
            make.top.trailing.bottom.equalTo(self)
            make.width.equalTo(retweetButton)
        }
        
        //分割视图1
        separatorViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(commetButton)
            make.centerX.equalTo(commetButton.snp_leading)
        }
        //分割视图2
        separatorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(commetButton)
            make.centerX.equalTo(commetButton.snp_trailing)
        }
        
    }
    

    //MARK: -懒加载
    ///转发按钮
    
    private lazy var retweetButton: UIButton =
        UIButton(image: "timeline_icon_retweet", title: "转发")
    
    
//    private lazy var retweetButton: UIButton = {
//        let button = UIButton()
//        
//        //设置按钮背景图片
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        
//        //设置按钮图片
//        button.setImage(UIImage(named: "timeline_icon_retweet"), forState: UIControlState.Normal)
//        //设置按钮标题
//        button.setTitle("转发", forState: UIControlState.Normal)
//        
//        return button
//    }()
    
    ///评论按钮
    
    private lazy var commetButton: UIButton = UIButton(image: "timeline_icon_comment", title: "评论")
    
//    private lazy var commetButton: UIButton = {
//        let button = UIButton()
//        
//        //设置按钮背景图片
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        
//        //设置按钮图片
//        button.setImage(UIImage(named: "timeline_icon_comment"), forState: UIControlState.Normal)
//        //设置按钮标题
//        button.setTitle("评论", forState: UIControlState.Normal)
//        
//        return button
//    }()
    
    ///赞
     private lazy var likeButton: UIButton = UIButton(image: "timeline_icon_unlike", title: "赞")
    
//    private lazy var likeButton: UIButton = {
//        let button = UIButton()
//        
//        //设置按钮背景图片
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        
//        //设置按钮图片
//        button.setImage(UIImage(named: "timeline_icon_unlike"), forState: UIControlState.Normal)
//        //设置按钮标题
//        button.setTitle("赞", forState: UIControlState.Normal)
//        
//        return button
//    }()
    
    ///分割线1
    private lazy var separatorViewFirst: UIImageView = UIImageView(imageNamed: "timeline_card_bottom_line")
    
    private lazy var separatorViewSecond: UIImageView = UIImageView(imageNamed: "timeline_card_bottom_line")
}
